package com.company.工厂模式2;

import com.company.工厂模式2.impl.Huawei;
import com.company.工厂模式2.impl.IPhone;

public class PhoneFactory {
    PhoneFactory() {
    }
    private static final int TYPE_I=2;
    private static final int TYPE_H=1;

    public Phone createPhone(int type){
        switch (type){
            case TYPE_H:
                return new Huawei();
            case TYPE_I:
                return new IPhone();
            default:
                throw new RuntimeException("工厂暂时只能生产华为和apple两种手机");
        }
    }
}
